package com.wang.tool.delivery.base;

import com.wang.tool.util.CommonUtil;

import java.util.List;
import java.util.Map;

/**
 * @Description 翻页参数
 * @Author shaopeng
 * @Date 2022/8/7
 * @Version 1.0
 */
public class PageParam {

    /**
     * session
     * 翻页时传入
     */
    private String session;

    /**
     * 页码
     */
    private Integer pageNum;

    /**
     * 投承一体时使用
     * 置顶的实体
     * spId-list
     */
    private Map<String, List<String>> tops;

    /**
     * 投承一体时使用
     * 点击的是哪个实体?
     */
    private String clickEntityId;

    /**
     * 投承一体时使用
     * 点击的实体是哪个排期的?
     */
    private String clickSpId;

    /**
     * 指定写入的session
     *
     */
    private String writeSession;


    public PageIntentionEnum decidePageIntention(){
        if(CommonUtil.isNotEmpty(getTops())){
            return PageIntentionEnum.RECEPT;
        }
        if(CommonUtil.isAnyBlank(getClickEntityId(), getClickSpId())){
            return PageIntentionEnum.PAGE;
        }
        return PageIntentionEnum.RECEPT;
    }


    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getClickEntityId() {
        return clickEntityId;
    }

    public void setClickEntityId(String clickEntityId) {
        this.clickEntityId = clickEntityId;
    }

    public String getClickSpId() {
        return clickSpId;
    }

    public void setClickSpId(String clickSpId) {
        this.clickSpId = clickSpId;
    }

    public Map<String, List<String>> getTops() {
        return tops;
    }

    public void setTops(Map<String, List<String>> tops) {
        this.tops = tops;
    }

    public String getWriteSession() {
        return writeSession;
    }

    public void setWriteSession(String writeSession) {
        this.writeSession = writeSession;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }
}
